
<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>佰林の预定信息</title>
    <link rel="stylesheet" href="/common/layui/css/layui.css">
    <link rel="stylesheet" href="/admin/css/style.css">
    <script src="/common/layui/layui.js"></script>
    <script src="/common/jquery-3.3.1.min.js"></script>
    <script src="/common/vue.min.js"></script>
</head>
<body>

<div class="main" id="app">
    <!--        左侧数据-->
    <div id="fixedData">
        <!--顶栏-->
        <header>
            <h1 v-text="webname"></h1>
            <div class="breadcrumb">
                <i class="layui-icon">&#xe715;</i>
                <ul>
                    <li v-for="vo in address">
                        <a  v-text="vo.name" :href="vo.url" ></a> <span>/</span>
                    </li>
                </ul>
            </div>
            <a>预订信息查询</a>
        </header>
        <!--左栏-->
        <div class="left">
            <ul class="cl" >
                <!--顶级分类-->
                <li v-for="vo,index in menu" :class="{hidden:vo.hidden}">
                    <a href="javascript:;"  :class="{active:vo.active}"  @click="onActive(index)">
                        <i class="layui-icon" v-html="vo.icon"></i>
                        <span v-text="vo.name"></span>
                        <i class="layui-icon arrow" v-show="vo.url.length==0">&#xe61a;</i> <i v-show="vo.active" class="layui-icon active">&#xe623;</i>
                    </a>
                    <!--子级分类-->
                    <div v-for="vo2,index2 in vo.list">
                        <a href="javascript:;" :class="{active:vo2.active}" @click="onActive(index,index2)" v-text="vo2.name"></a>
                        <i v-show="vo2.active" class="layui-icon active">&#xe623;</i>
                    </div>
                </li>
            </ul>
        </div>
    </div>
    <!--右侧-->
    <div class="right" id="Right">
        <div class="layui-row">
            <div class="layui-col-lg8">
                <div class="layui-btn-group">
                    <button type="button" class="layui-btn layui-btn-sm" @click="getReserve(0)">未预定</button>
                    <button type="button" class="layui-btn layui-btn-danger layui-btn-sm" @click="getReserve(1)">已预定</button>
                </div>
            </div>
            <div  class="layui-col-lg4" style="text-align: right">

                <div class="layui-input-inline" style="width: 300px">
                    <input type="text" name="k" value="" placeholder="餐位类型" class="layui-input key">
                </div>
                <button type="button" class="layui-btn sou">搜索</button>
            </div>
        </div>

        <table class="layui-table layui-form">

            <thead>
            <tr>
                <th><a href="?/admin/user/index/order/uid.html">序号</a></th>
                <th>UUID</th>
                <th>可预约时间段</th>
                <th>餐位类型</th>
                <th>餐位号码</th>
                <th>预订人姓名</th>
                <th>电话</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            <tr class="id36567" v-for="(item,index) of reserveList" :key="index" >
                <td>{{index+1}}</td>
                <td>{{item.id}}</td>
                <td>{{item.reserveTime}}</td>
                <td>{{item.roomType}}</td>
                <td>{{item.tableNum}}</td>
                <td>{{item.realName}}</td>
                <td>{{item.phone}}</td>
                <td>
                    <button class="layui-btn  layui-btn-xs layui-btn-danger" @click="adminDelReserve(item.id)">删除预订</button>
                </td>
            </tr>

            </tbody>
        </table>
    </div>
    <script src="/admin/js/config.js"></script>
    <!--<script src="/admin/js/script.js"></script>-->
    <script>
        let right = new Vue({
            el:'#Right',
            data: {
                reserveList:[],
                commodityType:[],
                status:0,

            },
            methods:{
                //获取当前用户预订信息
                getReserve(status){
                    $.ajax({
                        url:'reserve/select',
                        type:'post',
                        data:JSON.stringify({
                            status:status,

                        }),
                        contentType: "application/json;charset=UTF-8",
                        success: (data)=> {
                            this.reserveList = data;
                        }
                    })
                },  adminDelReserve(id){
                    $.ajax({
                        url:'reserve/delete',
                        type:'post',
                        data:JSON.stringify({
                            id:id
                        }),
                        contentType: "application/json;charset=UTF-8",
                        success: (data)=> {
                            window.alert("预订信息已删除!")
                            this.getReserve(0)
                        }
                    })


                },

            },
            mounted(){
                this.getReserve(0)
                // this.getDataCount()
            },
        })
    </script>
</body>
</html>
